import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import App from './App'
import Login from './pages/login'
import Admin from './admin'
import Buttons from './pages/ui/buttons'
import Modals from './pages/ui/modals'
import Carousel from './pages/ui/carousel'
import Gallery from './pages/ui/gallery'
import NoMatch from './pages/nomatch'
import FormLogin from './pages/form/login'
import FormRegister from './pages/form/register'
import BasicTable from './pages/table/basicTable'
import HighTable from './pages/table/highTable'
import City from './pages/city/index'
import Order from './pages/order/index'
import BikeMap from './pages/map/bikeMap'
import Rich from './pages/rich/index'
import OrderDetail from './pages/order/detail'
import Common from './common';
import User from './pages/user'
import Bar from './pages/echarts/bar/index'
import Pie from './pages/echarts/pie/index'
import Line from './pages/echarts/line/index'
import Permission from './pages/permission/index'
export default class IRouter extends Component{
    render(){
        return (
            <Router>
                 <App>
                    <Switch>
                        <Route path="/login" component={Login} />
                        <Route path="/common" render = {() => 
                            <Common>
                                <Route path="/common/order/detail/:orderId" component={OrderDetail}></Route>
                            </Common>
                        }
                        />
                        <Route path="/admin" render={() => 
                            <Admin>
                                <Switch>
                                    <Route path="/admin/ui/buttons" component={Buttons} />
                                    <Route path="/admin/ui/modals" component={Modals} />
                                    <Route path="/admin/ui/carousel" component={Carousel} />
                                    <Route path="/admin/ui/gallery" component={Gallery} />
                                    <Route path="/admin/form/login" component={FormLogin} />
                                    <Route path="/admin/form/reg" component={FormRegister} />
                                    <Route path="/admin/table/basic" component={BasicTable} />
                                    <Route path="/admin/table/high" component={HighTable} />
                                    <Route path="/admin/city" component={City} />
                                    <Route path="/admin/order" component={Order} />
                                    <Route path='/admin/bikeMap' component={BikeMap} />
                                    <Route path='/admin/user' component={User} />
                                    <Route path='/admin/rich' component={Rich} />
                                    <Route path="/admin/charts/bar" component={Bar} />
                                    <Route path="/admin/charts/pie" component={Pie} />
                                    <Route path="/admin/charts/line" component={Line} />
                                    <Route path="/admin/permission" component={Permission} />
                                    <Route component={NoMatch} />
                                </Switch>
                            </Admin>
                        } />
                    </Switch>
                </App>
            </Router>
        )
    }
}